package com.easyfun.healthmagicbox.comm.json;

import org.json.JSONException;
import org.json.JSONObject;

import com.easyfun.healthmagicbox.pojo.User;

public class UserJsonWrapper<T extends JsonWrapper> extends AbstractJsonWrapper<T,User>{
	
	public UserJsonWrapper()
	{
	}
	
	public UserJsonWrapper(User pp)
	{
		super(pp);
	}

	@Override
	public void deserializeFromObj(JSONObject obj) throws JSONException {
		mpp = new User();
		mpp.setEmail(obj.getString("email"));
    	mpp.setInviteID(obj.getString("inviteID"));
    	mpp.setPassword(obj.getString("password"));
    	mpp.setPersonID(obj.getString("personID"));
    	mpp.setThirdloginID(obj.getString("thirdloginID"));
    	mpp.setThirdlogintype(obj.getString("thirdlogintype"));
    	mpp.setUsername(obj.getString("username"));
		
	}

	@Override
	public JSONObject serializeToObj() throws JSONException {

        JSONObject serializedObj = new JSONObject();
        serializedObj.put("email", mpp.getEmail());
        serializedObj.put("inviteID", mpp.getInviteID());
        serializedObj.put("password", mpp.getPassword());
        serializedObj.put("personID", mpp.getPersonID());
        serializedObj.put("thirdloginID", mpp.getThirdloginID());
        serializedObj.put("thirdlogintype", mpp.getThirdlogintype());
        serializedObj.put("username", mpp.getUsername());
        return serializedObj;
 
	}

		
}
